<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    /* canvas{
      background-color: aqua;
    } */
  </style>
</head>
<body>
  <canvas id="canvas" width="400" height="400"></canvas>
  <script>
    /** @type {HTMLCanvasElement} */
    var canvas=document.querySelector("#canvas")
    var ctx=canvas.getContext("2d")
    ctx.translate(100,100)
    ctx.scale(-1,2)
    var index=1
    function xz(){
      ctx.clearRect(0,0,400,400)
      // index+=0.1
      ctx.rotate(Math.PI/180*index)
      ctx.fillRect(0,0,100,100)
      requestAnimationFrame(xz)
    }
    xz()
    
  </script>
</body>
</html>